import React from 'react'
import { Provider } from 'react-redux'
import { BrowserRouter, Switch, Route,hashHistory} from 'react-router-dom'

import DevTools from './DevTools.jsx'

import MobileApp from './mobile/app.jsx'
import Login from './mobile/login.jsx'
import PcApp from './pc/app.jsx'
import { isPC } from './common/dervice.js'

export default ({ store }) => {
  return <Provider store={store}>
    {
      isPC() ?
        <div>
          <PcApp />
          <DevTools />
        </div>
        :
        <div>
          <BrowserRouter  basename="/" history={hashHistory} >
            <Switch>
              <Route exact  path='/' component={Login} />
              <Route exact  path='/graph/:id' component={MobileApp} />
              <Route exact  path='*' component={Login} />
            </Switch>
          </BrowserRouter>
          <DevTools />
        </div>
    }
  </Provider>
}
